#ifndef _MQTT_CLIENT_PUBLISH_
#define _MQTT_CLIENT_PUBLISH_

typedef struct mosquitto * Mosquitto;

typedef void (*REGEISTER_PUBLISH_HANDLE)(struct mosquitto *, void *, int);

/* 
 Register mqtt client subscribe topic handler to deal process
*/
typedef void (*REGEISTER_SUBSCRIBE_HANDLER)(const struct mosquitto_message *msg);

extern REGEISTER_SUBSCRIBE_HANDLER client_subscribe_message;

/* mqtt client subscribe connect status */
short client_subscribe_connect_status();

/* mqtt client subscribe message from topic topic */
unsigned short mqtt_client_subscribe(const char* topic);

/* client subscribe and publish initial connect */
unsigned short client_subscribe_init_connect(const char* host, 
            const char* port, 
            const char* username, const char* password);

unsigned short client_publish_init_connect(const char* host, 
            const char* port, 
            const char* username, const char* password);

/* mqtt client publish message to specify topic */
unsigned short mqtt_client_publish(const char* topic, const char* message);

/* mqtt client release publish resource */
void client_publish_release_resource();

/* mqtt client release subscribe resource */
void client_subscribe_release_resource();

#endif // mqtt_client_publish.h